package com.stox.charting.ui.swing.presenter.delegate.advisor;

import java.awt.Dimension;

import com.stox.charting.ui.swing.model.Axis;
import com.stox.charting.ui.swing.model.Orientation;
import com.stox.charting.ui.swing.model.Theme;

public class AxisSizeAdvisor {

	public void advise(Axis axis){
		if(axis != null){
			Dimension dimension = null;
			if(Orientation.HORIZONTAL.equals(axis.getOrientation())){
				dimension = new Dimension(axis.getParent().getWidth(), 
						Theme.getStructure().getHorizontalAxisHeight());
				axis.setSize(dimension);
				axis.setPreferredSize(dimension);
			}else{
				dimension = new Dimension(Theme.getStructure().getVerticalAxisWidth(), axis.getParent().getHeight());
				axis.setSize(dimension);
				axis.setPreferredSize(dimension);
			}
		}
	}
	
}
